Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stdout metrics exporter #666

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

martin308
Copy link

Add stdout metrics exporter

Adds the stdout metrics exporter alongside the trace and log stdout exporter.

Questions:

I've added Encodable/Codable to some of the types to make the JSON encoding a little easier. This doesn't match the pattern in StdoutSpanExporter which uses a wrapper that implements Codable. The StdoutLogExporter relies on the ReadableLogRecord being Codable. Is there a pattern that we want to standardize on for the std out exporters?

The StdoutSpanExporter encodes each SpanData as a separate JSON object whereas the StdoutLogExporter encodes the array of ReadableLogRecord instead of the individual objects. Do we want to standardize on one of these patterns for all of the std out exporters? I couldn't discern from the spec if either of these is the "correct" way to do it.

The other two std out exporters lack tests and so I've not added any for this one. Is this a blocker to merging?

Sample Output:

----------------------------------------
Name: name
Description: description
Unit: m
IsMonotonic: true
Resource: Resource(attributes: ["telemetry.sdk.name": opentelemetry, "service.name": unknown_service:xctest, "telemetry.sdk.language": swift, "telemetry.sdk.version": 1.12.1])
InstrumentationScopeInfo: InstrumentationScopeInfo(name: "name", version: Optional("1.0"), schemaUrl: Optional("https://honeycomb.io"))
Type: DoubleSum
AggregationTemporality: cumulative
DataPoints:
  - StartEpochNanos: 199
    EndEpochNanos: 199
    Attributes: ["attribute": 1.0]
    Exemplars:
      - EpochNanos: 0
        SpanContext: SpanContext{traceId=TraceId{traceId=00000000000000000000000000000000}, spanId=SpanId{spanId=0000000000000000}, traceFlags=TraceFlags{sampled=false}}, isRemote=false
        FilteredAttributes: ["filtered attribute": two]
        Value: 1.0
----------------------------------------
{"description":"description","isMonotonic":true,"resource":{"attributes":{"telemetry.sdk.version":{"string":{"_0":"1.12.1"}},"telemetry.sdk.language":{"string":{"_0":"swift"}},"telemetry.sdk.name":{"string":{"_0":"opentelemetry"}},"service.name":{"string":{"_0":"unknown_service:xctest"}}}},"type":{"DoubleSum":{}},"data":{"points":[{"attributes":{"attribute":{"double":{"_0":1}}},"exemplars":[{"spanContext":{"traceState":{"entries":[]},"traceId":{"idHi":0,"idLo":0},"spanId":{"id":0},"isRemote":false,"traceFlags":{"options":0}},"filteredAttributes":{"filtered attribute":{"string":{"_0":"two"}}},"epochNanos":0}],"startEpochNanos":199,"endEpochNanos":199}],"aggregationTemporality":{"cumulative":{}}},"name":"name","unit":"m","instrumentationScopeInfo":{"schemaUrl":"https:\/\/honeycomb.io","name":"name","version":"1.0"}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant